package com.xhwl.centiotdata.pollingtrigger.offlinedevice;

import com.xhwl.centiotdata.handler.offlinedevice.OfflineDeviceHandler;
import com.xhwl.centiotdata.pollingtrigger.ScheduleDispatcher;
import com.xhwl.centiotdata.utils.ThreadPoolUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @description:
 * @author: wuyuhao
 * @createDate: 2022/8/9 11:17
 */
@Slf4j
@Service
public class OfflineDeviceDispatcher implements ScheduleDispatcher {

    @Autowired
    private OfflineDeviceHandler handler;

    @Override
    public void doFiveMinutesTask() {
        ThreadPoolUtils.executor.execute(this::executeSaveOfflineDevice);
    }

    private void executeSaveOfflineDevice() {
        handler.syncOfflineDevice();
    }
}
